{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-25T00:06:30.940827Z",
     "start_time": "2020-12-25T00:06:30.632179Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-25T00:06:32.589825Z",
     "start_time": "2020-12-25T00:06:32.068278Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "b'Skipping line 40263: expected 2 fields, saw 3\\nSkipping line 65048: expected 2 fields, saw 3\\nSkipping line 111188: expected 2 fields, saw 4\\nSkipping line 132283: expected 2 fields, saw 3\\nSkipping line 133558: expected 2 fields, saw 3\\nSkipping line 142807: expected 2 fields, saw 3\\nSkipping line 209004: expected 2 fields, saw 3\\n'\n",
      "b'Skipping line 10349: expected 2 fields, saw 3\\nSkipping line 20945: expected 2 fields, saw 3\\nSkipping line 37120: expected 2 fields, saw 3\\nSkipping line 58585: expected 2 fields, saw 3\\n'\n",
      "b'Skipping line 24638: expected 2 fields, saw 3\\nSkipping line 26618: expected 2 fields, saw 3\\n'\n"
     ]
    }
   ],
   "source": [
    "df_train = pd.read_csv(\"./train.tsv\", sep=\"\\t\", error_bad_lines=False)\n",
    "df_dev = pd.read_csv(\"./val.tsv\", sep=\"\\t\", error_bad_lines=False)\n",
    "df_test = pd.read_csv(\"./test.tsv\", sep=\"\\t\", error_bad_lines=False)\n",
    "\n",
    "df_train = df_train.rename(columns={\"text_a\":\"sentence\"})\n",
    "df_dev = df_dev.rename(columns={\"text_a\":\"sentence\"})\n",
    "df_test = df_test.rename(columns={\"text_a\":\"sentence\"})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-23T02:13:14.688595Z",
     "start_time": "2020-12-23T02:13:13.839137Z"
    }
   },
   "outputs": [],
   "source": [
    "df_train.to_csv(\"train.csv\", index=False)\n",
    "df_dev.to_csv(\"dev.csv\", index=False)\n",
    "df_test.to_csv(\"test.csv\", index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-25T00:07:00.746072Z",
     "start_time": "2020-12-25T00:07:00.356813Z"
    }
   },
   "outputs": [],
   "source": [
    "df.to_csv(\"unsup.csv\", index=False)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-25T00:06:53.677445Z",
     "start_time": "2020-12-25T00:06:53.652188Z"
    }
   },
   "outputs": [],
   "source": [
    "df = df_dev.append(df_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-25T00:06:56.839729Z",
     "start_time": "2020-12-25T00:06:56.834984Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(153070, 2)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "torch1.7",
   "language": "python",
   "name": "torch1.7"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.12"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
